<%@page import="nl.hva.web.mvcwebapp.doa.UserDAO"%>
<%@page import="nl.hva.web.mvcwebapp.controllers.UserController"%>
<%@page import="nl.hva.web.mvcwebapp.models.User"%>
<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%-- 
    Document   : user_profile-body
    Created on : 16-Nov-2012, 16:53:07
    Author     : Roald
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%
    HttpSession session_user = request.getSession(true);
    int user_id = 0;
    
    String firstname = UserController.viewProfile.getUserFirstName();
    String lastname = UserController.viewProfile.getUserLastName();
    String email = UserController.viewProfile.getUserEmail();
    String LOO = UserController.viewProfile.getUserLandOfOrigin();
    String PROPIC = UserController.viewProfile.getProfilepicture();
    int UID = UserController.viewProfile.getUserId();
    if(!session_user.getAttribute("user_id").toString().isEmpty()){
        user_id = (Integer) session_user.getAttribute("user_id");
    }
%>
<style type="text/css">
    .user-table th{
        text-align:left; 
    }
    .profile-picture{
        border:2px solid orange;
    }
    .profile-header{
        padding-right:5px;
        padding-bottom:20px;
    }
    .edit{
        top:5px;
    }

</style>
<h2 class="profile-header" style="">${pageTitle}</h2>
<br/>
<br/>
<div class="right">
    <img class="profile-picture" width="150px" height="150px" src="<%=PROPIC%>"></img>
</div>
<div class="left">
    <table class="user-table">
        <tr>
            <th>First Name:</th>
            <td><%=firstname%></td>
        </tr>
        <tr>
            <th>Last name:</th>
            <td><%=lastname%></td>
        </tr>
        <tr>
            <th>Email:</th>
            <td><%=email%></td>
        </tr>
        <tr>
            <th>Nationality:</th>
            <td><%=LOO%></td>
        </tr>
        <tr>
            <th>Type of User:</th>
            <td>${usertype}</td>
        </tr>
    </table>
    <% if (user_id == UID) {%>
    <p>
        <a class="button" href="edit?id=${user.userId}">Edit my profile!</a>
        <a class="button" href="user_changepw?id=${user.userId}">Change my password!</a>
    </p>
    <% } else {
        
    }%>
</div>

